Ext.define('cceaf.control.sms.PhraseField',{
	extend: 'Ext.form.TextField', 
    alias: 'widget.cceafphrasefield',

	constructor: function(config){
		config = config || {};
	
		config = Ext.apply(config || {}, {
			//width: 150,
			style: 'cursor:hand',
			enableKeyEvents: true,
			readOnly: true,
			listeners:{
	    		'focus':function(){
	    			var selectPhraseWin = Ext.getCmp("selectPhraseWin");
	    			if(selectPhraseWin == null){
		    			selectPhraseWin = new Ext.Window({
		    	    		id:'selectPhraseWin',
		    	        	title: '选择短语',
		    	        	modal: true,
		    	        	closeAction: 'hide',
		    	        	x: this.getPosition()[0],
		    	        	y: this.getPosition()[1],
		    	        	height: 250,
		    	        	width: 170,
		    	        	autoScroll: true,
		    	        	layout: 'fit',
		    	        	items: [new cceaf.control.sms.SelectPhraseTree({idOfNodeid:config.idOfNodeid,idOfNodename:config.id})]
		    			});
	    			}
	    			else{
	    				selectPhraseWin.setPosition(this.getPosition()[0],this.getPosition()[1]);
	    			}
	    			
	    			selectPhraseWin.show();
	    			
	    			var selectPhraseTree = Ext.get("selectPhraseTree");
    				selectPhraseTree.idOfNodeid = config.idOfNodeid;
    				selectPhraseTree.idOfNodename = config.id;
	    		}
	    	}
		});

		cceaf.control.sms.PhraseField.superclass.constructor.apply(this, arguments);
	}
});